﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlReportDSNgayV2.ascx.cs" Inherits="UserControl_ControlReportDSNgayV2" %>

<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>

<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPivotGrid" tagprefix="dxwpg" %>
<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v9.2.Export, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraPivotGrid.Web" tagprefix="dxpgw" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>


<script type="text/javascript">
    function pageLoad() {



        $("#<%= imgBtnAdd.ClientID %>").click(function () {

            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });

        });
        $("#<%= imgBtnSave.ClientID %>").click(function () {
            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });
            setTimeout($.unblockUI, 5000);
        });
        $("#<%= imgBtnPivot.ClientID %>").click(function () {
            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });
            setTimeout($.unblockUI, 5000);
        });
        $("#<%= ImgBtnRefresh.ClientID %>").click(function () {
            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });
        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }

    }

</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="imgBtnSave" />
<asp:PostBackTrigger ControlID="imgBtnPivot" />
</Triggers>
    <ContentTemplate>
    
                <div class="direct_container_right_titletop direct_colleft">
                    Báo cáo doanh số ngày
                </div>
                
                <!-- Button chuc nang-->
                <div class="direct_menu_report_page direct_colleft">
              
                    Tháng
                    <asp:DropDownList ID="DropMonthy" runat="server">
                    </asp:DropDownList>
                    <asp:CheckBox ID="chFilterDaily" Checked="false" runat="server" />
                     Từ ngày
                 <asp:DropDownList ID="DropFrom" CssClass="input_code" runat="server">
                    </asp:DropDownList>
                đến ngày
                 <asp:DropDownList ID="DropTo" CssClass="input_code" runat="server">
                    </asp:DropDownList>
                  
                    <asp:ImageButton ID="imgBtnAdd" CausesValidation="false" onclick="imgBtnAdd_Click" ToolTip="Lấy dữ liệu"  ImageUrl="~/Images/Document.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnSave" onclick="imgBtnSave_Click" CausesValidation="false" ToolTip="Xuất ra file excel dạng thường" ImageUrl="~/Images/download.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnPivot" onclick="imgBtnPivot_Click" CausesValidation="false" ToolTip="Xuất ra pivot excel" ImageUrl="~/Images/Rename.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="ImgBtnRefresh" onclick="imgBtnRefresh_Click" CausesValidation="false" ToolTip="Reset lại dữ liệu" ImageUrl="~/Images/Refresh.png" Width="32px" Height="32px" runat="server" />
                    
                </div>
                <!-- End Button chuc nang-->
                <div class="clear"></div>
                 <hr />

                
                   <table>
                   
                    <tr>
                    <td>
                      <dxpgw:ASPxPivotGridExporter ID="ASPxPivotGridExporter1" ASPxPivotGridID="ASPxPivotGrid1" runat="server" Width="100%">
        </dxpgw:ASPxPivotGridExporter>
      <dxwpg:ASPxPivotGrid ID="ASPxPivotGrid1" CustomizationFieldsVisible="True"    runat="server">
                   
                 <Fields>
         
                <dxwpg:PivotGridField ID="fieldKHO"  Area="FilterArea"  AreaIndex="0" 
                         Caption="Kho" FieldName="KHO">
                </dxwpg:PivotGridField>
                
                <dxwpg:PivotGridField ID="fieldTenHangTheoNPP" Area="FilterArea"  AreaIndex="1" 
                         Caption="Tên hàng theo NPP" FieldName="TenHangTheoNPP" Visible="False">
                </dxwpg:PivotGridField>

                 <dxwpg:PivotGridField ID="fieldTenHangTheoFimex" Area="FilterArea"  AreaIndex="5" 
                         Caption="Tên hàng theo Fimex" FieldName="TenHangTheoFimex" Visible="False">
                </dxwpg:PivotGridField>
                
               
                <dxwpg:PivotGridField ID="fieldGAM" Area="FilterArea" AreaIndex="2" 
                         Caption="Gam hàng" FieldName="GAM" Visible="False">
                     </dxwpg:PivotGridField>

                <dxwpg:PivotGridField ID="fieldGroupSKU" Area="FilterArea"  AreaIndex="3" 
                         Caption="Group" FieldName="GroupSKU" Visible="False">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="fieldTENKH" Area="FilterArea"  AreaIndex="4" 
                         Caption="Tên khách hàng" FieldName="TENKH" Visible="False">
                </dxwpg:PivotGridField>
                <dxwpg:PivotGridField ID="fieldDC" Area="FilterArea"  AreaIndex="6" 
                         Caption="Địa chỉ" FieldName="DC" Visible="False">
                </dxwpg:PivotGridField>

                <dxwpg:PivotGridField ID="fieldQHT" Area="FilterArea" AreaIndex="7" 
                         Caption="Tỉnh/Thành" FieldName="QHT" Visible="False">
                     </dxwpg:PivotGridField>

                     <dxwpg:PivotGridField ID="fieldQuanHuyen" AreaIndex="8" 
                         Caption="Quận/Huyện" FieldName="QuanHuyen" Area="FilterArea" 
                         Visible="False">
                     </dxwpg:PivotGridField>

                     <dxwpg:PivotGridField ID="fieldSubChannelName" AreaIndex="9" 
                         Caption="Sub channel" FieldName="SubChannelName"  Area="FilterArea"  Visible="False">
                     </dxwpg:PivotGridField>
                     <dxwpg:PivotGridField ID="fieldChannelName" Area="FilterArea" AreaIndex="10" 
                     Caption="Channel" FieldName="ChannelName">
                     </dxwpg:PivotGridField>
                     <dxwpg:PivotGridField ID="fieldLAND" AreaIndex="11" Caption="Vùng" 
                         FieldName="LAND" Area="FilterArea" Visible="False">
                     </dxwpg:PivotGridField>
                     <dxwpg:PivotGridField ID="fieldINVOICE" Area="FilterArea" AreaIndex="12" 
                         Caption="Số chứng từ" FieldName="INVOICE" Visible="False">
                     </dxwpg:PivotGridField>
                      <dxwpg:PivotGridField ID="PivotNGAY" Area="FilterArea" AreaIndex="13" 
                         Caption="Ngày" FieldName="NGAY" Visible="False">
                     </dxwpg:PivotGridField>
                      <dxwpg:PivotGridField ID="Pivotsitename" Area="RowArea" AreaIndex="0" 
                         Caption="Trung tâm phân phối" FieldName="sitename">
                     </dxwpg:PivotGridField>
                      <dxwpg:PivotGridField ID="PivotTDV" Area="FilterArea" AreaIndex="14" 
                         Caption="Trình dược viên bán hàng" FieldName="TDV">
                     </dxwpg:PivotGridField>
                      <dxwpg:PivotGridField ID="PivotTinhDoanhSoCho" Area="FilterArea" AreaIndex="15" 
                         Caption="Trình dược viên thụ hưởng" FieldName="TinhDoanhSoCho">
                     </dxwpg:PivotGridField>
                      <dxwpg:PivotGridField ID="Pivottrntyp" Area="FilterArea" AreaIndex="16" 
                         Caption="Loại đơn hàng" FieldName="trntyp" Visible="False">
                     </dxwpg:PivotGridField>
                     <dxwpg:PivotGridField ID="fieldSoLuong" Area="DataArea" AreaIndex="0" 
                         Caption="Số lượng" CellFormat-FormatString="{0:###,###.###}" 
                         AllowedAreas="DataArea"
                         CellFormat-FormatType="Numeric" FieldName="SoLuong">
                     </dxwpg:PivotGridField>
                     <dxwpg:PivotGridField ID="fieldDSoTruocThue" Area="DataArea" AreaIndex="1" 
                         Caption="Doanh số trước thuế" CellFormat-FormatString="{0:###,###.###}" 
                          AllowedAreas="DataArea"
                         CellFormat-FormatType="Numeric" FieldName="DSoTruocThue">
                     </dxwpg:PivotGridField>
                     <dxwpg:PivotGridField ID="fieldDSoSauThue" Area="DataArea" AreaIndex="2" 
                         Caption="Doanh số sau thuế" CellFormat-FormatString="{0:###,###.###}" 
                          AllowedAreas="DataArea"
                         CellFormat-FormatType="Numeric" FieldName="DSoSauThue">
                     </dxwpg:PivotGridField>

                     

                </Fields>
                 <OptionsView ShowColumnHeaders="False" ShowDataHeaders="False" />
                <OptionsPager Visible="False">
               </OptionsPager>
        </dxwpg:ASPxPivotGrid>
                    </td>
                    </tr>
                 </table>
                              
             <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>